
/**
 *  Class: Datastructures, CSI 326 Fall 2011
 *  Members: Christopher Nerf, Greg Shevach, Mesfin Solomon, Vidat Muslim
 *  Project: Project 1
 *  Scope: Implement a stack using one of the basic containers we have or will discuss. Example: A vector or list based stack.
 *  	   Implement a queue using one of the basic containers we have or will discuss. Example: A circular array or list based
 *		   queue
 *		   Develop and implement a palindrome checker that uses your stack and/or queue.
 *				 The data to be checked as a palindrome will consist of string characters, possibly containing whitespace and
 *				punctuation.
 *				 A palindrome reads the same forward as backward, ignoring case, whitespace and punctuation.
 *				 The strings to check will be stored in a file, one string per line. The file will contain the string quit to signify
 *				the end of file.
 *				 The strings can be of any length
 *  Version: 0.0 - Initial Pass
 */

//This is the queue.
//It uses a DoubleList
//Allows one to add (queue) and removeFront (dequeue), getsize, isempty, toString (deqeues all)


public class Queue<T>
{
	
	private DoubleList<T> queue;
	
	public Queue(T element)
	{
		DoubleNode<T> e = new DoubleNode<T>(element);
		queue = new DoubleList<T>(e);
	}
	
	public Queue()
	{
		queue = new DoubleList<T>();
	}
	
	public void add(T element)
	{
		queue.addElementToEnd(element);
	}
	
	public T removeFront()
	{
		return queue.removeFirst();
	}
	
	public int getSize()
	{
		return queue.size();
	}
	
	public boolean isEmpty()
	{
		return queue.isEmpty();
	}
	
	public String toString() //dequeues all elements
	{
		int size = this.getSize();
		String allElements ="";
		while(size-- > 0)
		{
			allElements += this.removeFront();
		}
		return allElements;
	}

}
